
#include "head.h"
#include "sstable.h"

int Search_Seq(SSTable ST,KeyType key)
{
	int i;
	ST.elem[0].key=key;
	for (i=ST.length;!EQ(ST.elem[i].key,key);--i)
	{
		;
	}
	return i;
}

int Search_Bin(SSTable ST,KeyType key)
{
	int low=0,high=ST.length,mid;
	while (low<=high)
	{
		mid=(low+high)/2;
		if (EQ(key,ST.elem[mid].key))
		{
			return mid;
		}
		else if (LT(key,ST.elem[mid].key))
		{
			high=mid-1;
		} 
		else
		{
			low=mid+1;
		}
	}
	return 0;
}